#ifndef TIMER_H
#define TIMER_H

#include <unistd.h>
#include "requestData.h"


struct requestData;  //前向声明，否则编译器无法解析自定义类型

class mytimer {
public:
    mytimer(requestData *_request_data, int timeout); //以毫秒计
    ~mytimer();

    bool is_expire();

    bool is_deleted();

    void set_deleted(); //分离定时器

    long getExpTime() const;

private:
    bool deleted; //隐式删除
    long expired_time;
    requestData *request_data;
};

struct timerCmp {
    bool operator()(const mytimer *a, const mytimer *b) const;
};


#endif 
